import logging

import requests


def get_headers():
    session = requests.session()
    data = {"mobile": "13800000002", "password": "123456"}
    url = "http://ihrm.itheima.net/prod-api/sys/login"
    result = session.post(url=url, json=data)

    token = f"Bearer {result.json().get('data')}"

    HEADER = {
        "Content-Type": "application/json",
        "Authorization": token
    }
    logging.info("获取token成功")
    return HEADER,session

if __name__ == '__main__':
    get_headers()